package Test1;


import java.awt.*;
import java.lang.*;
import java.applet.*;
import java.awt.event.*;
import javax.swing.*;

public class Login extends JFrame implements ActionListener  {
	
JPanel p1=new JPanel(new GridLayout(5,1));
//JPanel p2=new JPanel(new GridLayout(1,2));
//JPanel p3=new JPanel(new GridLayout(1,2));
// p4=new JPanel(new GridLayout(1,2));
//JPanel p5=new JPanel(new GridLayout(1,2));
JLabel am=new JLabel("Air-Malaysia....");
JLabel usrnm=new JLabel("Username : ");
JLabel nwm=new JLabel("Not yet a member? ");
JButton clk=new JButton("Click Here");
JLabel pswrd=new JLabel("Password : ");
JTextField txtname = new JTextField();
JPasswordField txtpswrd = new JPasswordField();
JButton btnOk=new JButton("Okay");
JButton btnCancel=new JButton("Exit");
Font f1 = new Font("TimesRoman",Font.BOLD,20);
Font f2 = new Font("TimesRoman",Font.BOLD,11);

    public Login() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(400,400);
    
    java.awt.Container contents = getContentPane();
    contents.setLayout(null);
    setTitle("Air-Malaysia");
    contents.setLayout(null );
    contents.setBackground(Color.black);
    contents.setForeground(Color.orange);
     am.setFont(f1);
     usrnm.setFont(f2);
     clk.setFont(f2);
     clk.setBackground(Color.black);
     clk.setForeground(Color.orange);
     btnOk.setBackground(Color.black);
     btnOk.setForeground(Color.orange);
     btnCancel.setBackground(Color.black);
     btnCancel.setForeground(Color.orange);
     usrnm.setForeground(Color.orange);
     pswrd.setForeground(Color.orange);
     nwm.setForeground(Color.orange);
     am.setForeground(Color.orange);

    am.setLocation(100,0);
    am.setSize(150,150);
    contents.add(am);

        usrnm.setLocation(20,100);
    	usrnm.setSize(120,25);
    	add(usrnm);
        
        txtname.setLocation(100,100);
    	txtname.setSize(120,25);
    	add(txtname);

        pswrd.setLocation(20,150);
    	pswrd.setSize(120,25);
    	add(pswrd);

        txtpswrd.setLocation(100,150);
    	txtpswrd.setSize(120,25);
    	add(txtpswrd);

        nwm.setLocation(20,200);
    	nwm.setSize(120,25);
    	add(nwm);

        clk.setLocation(200,200);
    	clk.setSize(120,25);
    	add(clk);

        btnOk.setLocation(20,250);
    	btnOk.setSize(120,25);
    	add(btnOk);

        btnCancel.setLocation(200,250);
    	btnCancel.setSize(120,25);
    	add(btnCancel);
     btnOk.addActionListener(this);
     btnCancel.addActionListener(this);
    }

    public void actionPerformed(ActionEvent e){
        if(e.getSource()==btnOk)
        {
        JOptionPane.showMessageDialog(null, "Welcome Mr/Ms " + txtname.getText());
        OptionWindow customerPage = new OptionWindow();
    		//dispose();
    		customerPage.show();
        }
        
     if(e.getSource()==btnCancel)
         JOptionPane.showMessageDialog(null, "Thank You for using Air-Malaysia Online");
          System.exit(0);
}
 public static void main(String[] args) {
 new Login();
 }
}